<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">

<h:head>
	<title>祖龙娱乐  - BI系统</title>
	<link href="../../css/component.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="../../js/highcharts.js"></script>
    <script type="text/javascript" src="../../js/drawChart.js"></script>
	<script type="text/javascript" src="../../js/drawChart2.js"></script>
</h:head>

<h:body>
	<ui:param name="bean" value="#{iterativeEventClientAction}" />
	
	<span class="pagetitle">玩家分析 —— 激活转化</span>
	<p:separator />
	
	<!-- 右侧页面顶部查询部分 -->
	<h:form id="fsearch">
		<p:growl id="growl" showDetail="true" sticky="true" />
        <h:outputLabel id="radioHide" value="#{bean.dateRadio}" style="visibility: hidden"/>
        
	    <p:outputPanel id="customPanel" style="margin-bottom:10px">
	        <p:selectOneRadio id="customRadio" value="#{bean.dateRadio}" layout="custom">
	            <f:selectItem itemLabel="1" itemValue="1" />
	            <f:selectItem itemLabel="5" itemValue="5" />
	            <f:selectItem itemLabel="10" itemValue="10" />
	            <f:selectItem itemLabel="0" itemValue="0" />
	            <p:ajax update="radioHide customPanel :#{p:component('dform')}" listener="#{bean.radioChange}"/>
	        </p:selectOneRadio>
	 
	        <h:panelGrid id="opt" columns="14" cellpadding="5">
	            <p:radioButton id="opt1" for="customRadio" itemIndex="0" /> 
	            <h:outputLabel for="opt1" value="近1天" />
	            <h:outputLabel />
	 
	            <p:radioButton id="opt2" for="customRadio" itemIndex="1" />
	            <h:outputLabel for="opt2" value="近5天" />
	            <h:outputLabel />
	 
	            <p:radioButton id="opt3" for="customRadio" itemIndex="2" />
	            <h:outputLabel for="opt3" value="近10天" />
	            <h:outputLabel />
	             
	            <p:radioButton id="opt4" for="customRadio" itemIndex="3" />
	            <h:outputLabel for="opt4" value="自定义 开始时间" />
           	 	<p:calendar value="#{bean.dateStart}" mode="popup" pattern="yyyy-MM-dd">
           	 	</p:calendar>
				<h:outputLabel for="opt4" value="结束时间" />
				<p:calendar value="#{bean.dateEnd}" mode="popup" pattern="yyyy-MM-dd">
				</p:calendar>
           	 	
           	 	
	        </h:panelGrid>
	    </p:outputPanel>
		&#160;&#160;&#160;
		
		<p:selectOneMenu id="platformSel" styleClass="queryPlatform" value="#{bean.queryPlatform}">
	        <f:selectItems value="#{bean.platformItmes}" />
	        <p:ajax update="channelSel serverSel" listener="#{bean.updateChannelItmes}" />
        </p:selectOneMenu>
        &#160;&#160;&#160;
        
        <p:selectOneMenu id="channelSel" styleClass="queryChannel" value="#{bean.queryChannel}">
	        <f:selectItems value="#{bean.channelItmes}" />
	        <p:ajax update="serverSel platformSel" listener="#{bean.updateServerItmes}" />
        </p:selectOneMenu>
        &#160;&#160;&#160;
        
        <p:selectOneMenu id="serverSel" styleClass="queryServer" value="#{bean.queryServer}" rendered="false">
	         <f:selectItems value="#{bean.serverItmes}" />
	         <p:ajax update="channelSel platformSel" listener="#{bean.selectedServer}" />
        </p:selectOneMenu>
        &#160;&#160;&#160;
        <p:column id="enterStepId" headerText="进入步骤" style="width:200px">
		        <p:selectOneMenu id="enterStepSel" styleClass="queryServer" value="#{bean.enterId}">
			         <f:selectItems value="#{bean.enterItmes}" />
		        </p:selectOneMenu>
        </p:column>
        &#160;&#160;&#160;
        <p:commandButton value="查询" action="#{bean.search()}" update=":data" ajax="false" />
	</h:form>
	<br />
	<!-- 数据展示部分，包含表格和图表 -->
	<h:form id="dform">
        <div class="data" id="data">
    		<p:panel id="panel2" header="激活设备步骤转化率" style="margin-bottom:10px;">
	    		<p:dataGrid id="chart1" var="c" value="#{bean.chartData1}" columns="1" layout="grid">
				        <p:panel style="text-align:center">
				            <h:panelGrid columns="1" style="width:100%">
				                <div id="highchartChart1" style="width:100%;height:300px; border:0;">
									<script type="text/javascript">
										generateChart2('#{c.jsonStr}', '#{bean.chartData2.jsonStr}', '#{c.jsonType}', '1');
									</script>  
								</div>
				            </h:panelGrid>
				        </p:panel>
				    </p:dataGrid>

                    <br />
                    <p:dataTable id="dlist1" var="l" value="#{bean.dataList1}" resizableColumns="true" paginator="true" paginatorPosition="top" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}" rowsPerPageTemplate="15,30" rows="30" style="text-align:center;">
                        <f:facet name="{Exporters}">
                            <h:commandLink styleClass="exporter">
                                <p:graphicImage url="/resources/images/excel.png" height="25px"/>
                                <p:dataExporter type="xls" target="dlist1" fileName="newAddPlayerData-#{pageHelper.getNewDateDetailStr()}"/>
                            </h:commandLink>
                        </f:facet>

                        <p:column headerText="序号" styleClass="column" style="width:100px">
                            <h:outputLabel value="#{l.index}" />
                        </p:column>
                        <p:column headerText="步骤名称" styleClass="column">
                            <h:outputLabel value="#{bean.getStepCodeName(l.stepcode)}(#{l.stepcode})" />
                        </p:column>
                        <p:column headerText="完成次数" styleClass="column" >
                            <h:outputLabel value="#{l.finishnum}" />
                        </p:column>
                        <p:column headerText="完成设备数" styleClass="column">
                            <h:outputLabel value="#{l.uuidnum}" />
                        </p:column>
                        <p:column headerText="分步转化率" styleClass="column">
                            <h:outputLabel value="#{pageHelper.double2Percent(l.distribute)}" />
                        </p:column>
                        <p:column headerText="累计完成率" styleClass="column">
                            <h:outputLabel value="#{pageHelper.double2Percent(l.totalAchieve)}" />
                        </p:column>
                    </p:dataTable>
			 </p:panel>

            <p:panel id="panel3" header="渠道通过率（TOP20）" style="margin-bottom:10px;">
                <p:dataGrid id="chart2" var="c" value="#{bean.chartDataChannel}" columns="1" layout="grid">
                    <p:panel style="text-align:center">
                        <h:panelGrid columns="1" style="width:100%">
                            <div id="highchartChart2" style="width:100%;height:300px; border:0;">
                                <script type="text/javascript">
                                    generateChart('#{c.jsonStr}', '#{c.jsonType}', '2');
                                </script>
                            </div>
                        </h:panelGrid>
                    </p:panel>
                </p:dataGrid>

                <br />
                <p:dataTable id="dlist2" var="l" value="#{bean.dataListChannel}" resizableColumns="true" paginator="true" paginatorPosition="top" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}" rowsPerPageTemplate="15,30" rows="30" style="text-align:center;">
                    <f:facet name="{Exporters}">
                        <h:commandLink styleClass="exporter">
                            <p:graphicImage url="/resources/images/excel.png" height="25px"/>
                            <p:dataExporter type="xls" target="dlist1" fileName="channelPlayerData-#{pageHelper.getNewDateDetailStr()}"/>
                        </h:commandLink>
                    </f:facet>

                    <p:column headerText="渠道ID" styleClass="column" style="width:100px" sortBy="#{l.channelId}">
                        <h:outputLabel value="#{l.channelId}" />
                    </p:column>
                    <p:column headerText="渠道名称" styleClass="column" sortBy="#{l.channelName}">
                        <h:outputLabel value="#{l.channelName}" />
                    </p:column>
                    <p:column headerText="点击icon设备数量" styleClass="column"  sortBy="#{l.beginnum}">
                        <h:outputLabel value="#{l.beginnum}" />
                    </p:column>
                    <p:column headerText="进入游戏设备数量" styleClass="column" sortBy="#{l.endnum}">
                        <h:outputLabel value="#{l.endnum}" />
                    </p:column>
                    <p:column headerText="整体通过率" styleClass="column" sortBy="#{l.allRadio}">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.allRadio)}" />
                    </p:column>

                    <p:column headerText="步骤通过率" styleClass="column" exportable="false">
                        <p:commandButton update=":dform:dataDetail" oncomplete="PF('dataDialog').show()" icon="ui-icon-search" title="查看">
                            <f:setPropertyActionListener value="#{l}" target="#{bean.selectedData}" />
                        </p:commandButton>
                    </p:column>
                </p:dataTable>
            </p:panel>
        </div>

        <p:dialog header="分步通过率详细信息" widgetVar="dataDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="false" position="150,1300" width="75%">
            <p:outputPanel id="dataDetail" style="text-align:center;">
                <p:dataTable id="dlist3" var="l" value="#{bean.selectedData.steps}" resizableColumns="true" paginator="false" paginatorPosition="top"  style="text-align:center;">
                    <f:facet name="header">
                        #{bean.selectedData.channelName}
                    </f:facet>
                    <p:column headerText="序号" styleClass="column" style="width:100px">
                        <h:outputLabel value="#{l.index}" />
                    </p:column>
                    <p:column headerText="步骤名称" styleClass="column">
                        <h:outputLabel value="#{bean.getStepCodeName(l.stepcode)}(#{l.stepcode})" />
                    </p:column>
                    <p:column headerText="完成次数" styleClass="column" >
                        <h:outputLabel value="#{l.finishnum}" />
                    </p:column>
                    <p:column headerText="完成设备数" styleClass="column">
                        <h:outputLabel value="#{l.uuidnum}" />
                    </p:column>
                    <p:column headerText="分步转化率" styleClass="column">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.distribute)}" />
                    </p:column>
                </p:dataTable>
            </p:outputPanel>
        </p:dialog>
	</h:form>

	<!-- 页脚 -->
	<div class="footer"></div>
</h:body>
</html>